using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Musicman.Entities.BusinessEntities
{
    public class SearchJobsConfigurationSection : ConfigurationSection
    {
        // private static bool _displayIt = false;

        SearchJobConfigurationElement job;

        public SearchJobsConfigurationSection()
        {
            job = new SearchJobConfigurationElement();
        }

        [ConfigurationProperty("jobs", IsDefaultCollection = false)]
        public SearchJobConfigurationElementCollection Jobs
        {
            get
            {
                SearchJobConfigurationElementCollection jobsCollection =
                (SearchJobConfigurationElementCollection)base["jobs"];
                return jobsCollection;
            }
        }

        [ConfigurationProperty("locations", IsDefaultCollection = false)]
        public SearchLoactionConfigurationElementCollection Locations
        {
            get
            {
                SearchLoactionConfigurationElementCollection locationCollection =
                (SearchLoactionConfigurationElementCollection)base["locations"];
                return locationCollection;
            }
        }

        public override bool IsReadOnly()
        {
            return false;
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Searhc jobs to run");
            foreach (SearchJobConfigurationElement _job in this.Jobs)
            {
                sb.AppendFormat("Type: {0}  Name {1} \r\n", _job.Stype, _job.Name);
            }
            sb.AppendLine("Locatons to run over");
            foreach (SearchLoacationConfigurationElement _location in this.Locations)
            {
                sb.AppendFormat("Path: {0} \r\n", _location.ServerPath);
            }
            return sb.ToString();
        }
    }
}
